package projeto.administrativo.checklist.cih;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory;
import org.zkoss.zkplus.spring.SpringUtil;

import projeto.administrativo.checklist.cdp.KItemChecklist;
import projeto.administrativo.checklist.cih.kitemchecklist.CtrlKItemChecklist;

import nucleo.comuns.visao.NucleoTab;

public class AbaKItemChecklist  extends NucleoTab{
		
	CtrlKItemChecklist ctrlKItemChecklist;	
	
	
	public AbaKItemChecklist(){
		ctrlKItemChecklist = SpringUtil.getApplicationContext().getBean(CtrlKItemChecklist.class);
		ctrlKItemChecklist.configurarComponentes();
		montar();		
		
	}

	private void montar() {		
		setNomeTab("Itens do Checklist");				
		setConteudoTab(ctrlKItemChecklist.getPainelKItemChecklist());				
	}	
	
	public  Set<KItemChecklist> getKItemChecklists(){	
		Set<KItemChecklist> set = new HashSet<KItemChecklist>(ctrlKItemChecklist.getKItemChecklists()); 
		return set ;		
	}
	
	public void setKItemChecklists(Set<KItemChecklist> kitens){		
		List<KItemChecklist> lista = new ArrayList<KItemChecklist>(kitens);
		ctrlKItemChecklist.preencherKItemChecklists(lista);			
	}
	
	
	public CtrlKItemChecklist getCtrlKItemChecklist() {
		return ctrlKItemChecklist;
	}

	public void setCtrlKItemChecklist(CtrlKItemChecklist ctrlKItemChecklist) {
		this.ctrlKItemChecklist = ctrlKItemChecklist;
	}
	
		

}

	
